// BatchSmsDialog.h : interface of the CBatchSmsDialog class
//
/////////////////////////////////////////////////////////////////////////////

#pragma once

#include "ExListViewCtrl.h"

#define SHIDIF_CANCEL \
    SHIDIF_CANCELBUTTON | SHIDIF_SIPDOWN | SHIDIF_SIZEDLGFULLSCREEN

template <class T, UINT t_shidiFlags = SHIDIF_CANCEL, bool t_bModal = false>
class ATL_NO_VTABLE CAppStdDialogResizeImplCancel :
    public CAppStdDialogImplBase<T, CStdDialogResizeImpl<T, t_shidiFlags, t_bModal>, t_shidiFlags, t_bModal>
{};

class CBatchSmsDialog : 
    public CAppStdDialogResizeImplCancel<CBatchSmsDialog>,
    public CUpdateUI<CBatchSmsDialog>,
    public CMessageFilter, public CIdleHandler
{
public:
    DECLARE_APP_DLG_CLASS(NULL, IDR_MAINFRAME, L"Software\\WTL\\BatchSms")

    enum { IDD = IDD_MAINDLG };

    virtual BOOL PreTranslateMessage(MSG* pMsg);

    // CAppWindow operations
    bool AppHibernate( bool bHibernate);

    bool AppNewInstance( LPCTSTR lpstrCmdLine);

    void AppSave();

#ifdef WIN32_PLATFORM_WFSP
    void AppBackKey();
#endif

    virtual BOOL OnIdle();

    BEGIN_UPDATE_UI_MAP(CBatchSmsDialog)
    END_UPDATE_UI_MAP()

    BEGIN_DLGRESIZE_MAP(CBatchSmsDialog)
        DLGRESIZE_CONTROL(IDC_LIST, DLSZ_SIZE_X | DLSZ_SIZE_Y)
    END_DLGRESIZE_MAP()

    BEGIN_MSG_MAP(CBatchSmsDialog)
        MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
        MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
#ifdef WIN32_PLATFORM_PSPC
        MESSAGE_HANDLER(WM_SETTINGCHANGE, OnSettingChange)
#endif
        COMMAND_ID_HANDLER(ID_MENU_EXIT, OnMenuExit)
        COMMAND_ID_HANDLER(ID_MENU_ABOUT, OnMenuAbout)
        NOTIFY_HANDLER(IDC_LIST, NM_RETURN, OnListReturn)
        NOTIFY_HANDLER(IDC_LIST, NM_CLICK, OnListClick)
        MESSAGE_HANDLER(WM_SIZE, OnSize)
        CHAIN_MSG_MAP(CAppStdDialogResizeImplCancel<CBatchSmsDialog>)
        REFLECT_NOTIFICATIONS()
    END_MSG_MAP()

private:
    // Handler prototypes (uncomment arguments if needed):
    //	LRESULT MessageHandler(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
    //	LRESULT CommandHandler(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
    //	LRESULT NotifyHandler(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/)

    LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled);
    LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled);
    LRESULT OnQuit(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled);

#ifdef WIN32_PLATFORM_PSPC
    LRESULT OnSettingChange(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
#endif

    LRESULT OnMenuExit(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
    LRESULT OnMenuAbout(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
    LRESULT OnListClick(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/);
    LRESULT OnListReturn(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/);
    LRESULT OnSize(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled);

    void OnItem(int ItemId);
    void AddName(CString &Name);

    enum
    {
        ITEM_BATCHES,
        ITEM_GROUPS,
        ITEM_DRAFTS,
        ITEM_HISTORY
    };

    CImageList m_ImageList;
    CExListViewCtrl m_List;
};

